//
//  GLTableViewController.m
//  GLFormKitDemo
//
//  Created by 121 on 2018/3/28.
//  Copyright © 2018年 杭州吉利控股信息中心. All rights reserved.
//

#import "GLTableViewController.h"
#import "GLCustomCell.h"
#import "GLCustomCellHelper.h"


@interface GLTableViewController ()

@property(nonatomic,strong)NSMutableArray* datas;

@end

@implementation GLTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.datas = [NSMutableArray arrayWithCapacity:0];
    
    for (NSInteger i = 0;i<99;i++) {
        [self.datas addObject:@{
                                @"icon":@"icon",
                                @"title":[NSString stringWithFormat:@"cell测试:%ld",i],
                                @"sub":@"nothing",
                                }];
    }
    
    
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.datas.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSInteger i = indexPath.row%6;
    NSString* identifier = [NSString stringWithFormat:@"GLCustomCellIdentifierCell%ld",i+1];
    GLCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[GLCustomCell alloc]initWithIdentifier:identifier];
    }
    NSDictionary* dict = [self.datas objectAtIndex:indexPath.row];
    [cell updateCellByModel:dict];
    // Configure the cell...
    
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 44;
}

@end
